.class public Lcom/glympse/platform/Platform$GToast;
.super Lcom/glympse/platform/GRunnable;
.source "Platform.java"


# annotations
.annotation system Ldalvik/annotation/EnclosingClass;
    value = Lcom/glympse/platform/Platform;
.end annotation

.annotation system Ldalvik/annotation/InnerClass;
    accessFlags = 0x1
    name = "GToast"
.end annotation


# instance fields
.field private m_lEndTime:J

.field private m_oToast:Landroid/widget/Toast;

.field final synthetic this$0:Lcom/glympse/platform/Platform;


# direct methods
.method public constructor <init>(Lcom/glympse/platform/Platform;III)V
    .locals 7
    .parameter
    .parameter "nIcon"
    .parameter "nText"
    .parameter "nDurationMS"

    .prologue
    const/4 v5, 0x0

    .line 1056
    iput-object p1, p0, Lcom/glympse/platform/Platform$GToast;->this$0:Lcom/glympse/platform/Platform;

    .line 1033
    invoke-direct {p0}, Lcom/glympse/platform/GRunnable;-><init>()V

    .line 1029
    const-wide/16 v3, 0x0

    iput-wide v3, p0, Lcom/glympse/platform/Platform$GToast;->m_lEndTime:J

    .line 1030
    iput-object v5, p0, Lcom/glympse/platform/Platform$GToast;->m_oToast:Landroid/widget/Toast;

    .line 1038
    :try_start_0
    invoke-static {}, Ljava/lang/System;->currentTimeMillis()J

    move-result-wide v3

    int-to-long v5, p4

    add-long/2addr v3, v5

    iput-wide v3, p0, Lcom/glympse/platform/Platform$GToast;->m_lEndTime:J

    .line 1041
    sget-object v3, Lcom/glympse/platform/Platform;->m_oContext:Landroid/content/Context;

    invoke-static {v3}, Landroid/view/LayoutInflater;->from(Landroid/content/Context;)Landroid/view/LayoutInflater;

    move-result-object v1

    .line 1042
    .local v1, inflater:Landroid/view/LayoutInflater;
    const v3, 0x7f030024

    const/4 v4, 0x0

    const/4 v5, 0x0

    invoke-virtual {v1, v3, v4, v5}, Landroid/view/LayoutInflater;->inflate(ILandroid/view/ViewGroup;Z)Landroid/view/View;

    move-result-object v2

    .line 1043
    .local v2, oView:Landroid/view/View;
    const v3, 0x7f0c0065

    invoke-virtual {v2, v3}, Landroid/view/View;->findViewById(I)Landroid/view/View;

    move-result-object v3

    check-cast v3, Landroid/widget/ImageView;

    invoke-virtual {v3, p2}, Landroid/widget/ImageView;->setImageResource(I)V

    .line 1044
    const v3, 0x7f0c0006

    invoke-virtual {v2, v3}, Landroid/view/View;->findViewById(I)Landroid/view/View;

    move-result-object v3

    check-cast v3, Landroid/widget/TextView;

    invoke-virtual {v3, p3}, Landroid/widget/TextView;->setText(I)V

    .line 1047
    new-instance v3, Landroid/widget/Toast;

    sget-object v4, Lcom/glympse/platform/Platform;->m_oContext:Landroid/content/Context;

    invoke-direct {v3, v4}, Landroid/widget/Toast;-><init>(Landroid/content/Context;)V

    iput-object v3, p0, Lcom/glympse/platform/Platform$GToast;->m_oToast:Landroid/widget/Toast;

    .line 1048
    iget-object v3, p0, Lcom/glympse/platform/Platform$GToast;->m_oToast:Landroid/widget/Toast;

    const/4 v4, 0x1

    invoke-virtual {v3, v4}, Landroid/widget/Toast;->setDuration(I)V

    .line 1049
    iget-object v3, p0, Lcom/glympse/platform/Platform$GToast;->m_oToast:Landroid/widget/Toast;

    invoke-virtual {v3, v2}, Landroid/widget/Toast;->setView(Landroid/view/View;)V

    .line 1050
    invoke-virtual {p0}, Lcom/glympse/platform/Platform$GToast;->Run()V
    :try_end_0
    .catch Ljava/lang/Exception; {:try_start_0 .. :try_end_0} :catch_0

    .line 1054
    .end local v1           #inflater:Landroid/view/LayoutInflater;
    .end local v2           #oView:Landroid/view/View;
    :goto_0
    return-void

    .line 1052
    :catch_0
    move-exception v3

    move-object v0, v3

    .line 1054
    .local v0, e:Ljava/lang/Exception;
    invoke-static {v0}, Lcom/glympse/platform/common/Helpers;->Log(Ljava/lang/Throwable;)V

    goto :goto_0
.end method


# virtual methods
.method public Run()V
    .locals 9

    .prologue
    const-wide/16 v7, 0xbb8

    .line 1063
    :try_start_0
    iget-wide v3, p0, Lcom/glympse/platform/Platform$GToast;->m_lEndTime:J

    invoke-static {}, Ljava/lang/System;->currentTimeMillis()J

    move-result-wide v5

    sub-long v1, v3, v5

    .line 1065
    .local v1, lRemaining:J
    iget-object v3, p0, Lcom/glympse/platform/Platform$GToast;->m_oToast:Landroid/widget/Toast;

    if-eqz v3, :cond_0

    .line 1067
    iget-object v3, p0, Lcom/glympse/platform/Platform$GToast;->m_oToast:Landroid/widget/Toast;

    invoke-virtual {v3}, Landroid/widget/Toast;->show()V

    .line 1078
    :goto_0
    cmp-long v3, v1, v7

    if-lez v3, :cond_1

    .line 1080
    iget-object v3, p0, Lcom/glympse/platform/Platform$GToast;->this$0:Lcom/glympse/platform/Platform;

    const-wide/16 v4, 0x3e8

    sub-long v6, v1, v7

    invoke-static {v4, v5, v6, v7}, Ljava/lang/Math;->min(JJ)J

    move-result-wide v4

    invoke-virtual {v3, p0, v4, v5}, Lcom/glympse/platform/Platform;->PostToMainThreadDelayed(Lcom/glympse/platform/GRunnable;J)Z

    .line 1091
    .end local v1           #lRemaining:J
    :goto_1
    return-void

    .line 1071
    .restart local v1       #lRemaining:J
    :cond_0
    const-wide/16 v1, 0x0

    goto :goto_0

    .line 1084
    :cond_1
    const/4 v3, 0x0

    iput-object v3, p0, Lcom/glympse/platform/Platform$GToast;->m_oToast:Landroid/widget/Toast;
    :try_end_0
    .catch Ljava/lang/Exception; {:try_start_0 .. :try_end_0} :catch_0

    goto :goto_1

    .line 1087
    .end local v1           #lRemaining:J
    :catch_0
    move-exception v3

    move-object v0, v3

    .line 1089
    .local v0, e:Ljava/lang/Exception;
    invoke-static {v0}, Lcom/glympse/platform/common/Helpers;->Log(Ljava/lang/Throwable;)V

    goto :goto_1
.end method
